<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>用户设置</title>
    <link rel="stylesheet" type="text/css" href="../../public/home/css/style_1_common.css" />
    <link rel="stylesheet" type="text/css" href="../../public/home/css/style_1_forum_index.css" />
    <link rel="stylesheet" id="css_extstyle" type="text/css" href="../../public/home/css/style.css" />
    <script src="../../public/home/js/common.js" type="text/javascript"></script>
    <script src="../../public/home/js/forum.js" type="text/javascript"></script>
    <script src="../../public/home/js/jquery-3.3.1.js" type="text/javascript"></script>
    <script src="../../public/home/js/jquery.min.js"></script>
    <style>
        #avatardesigner {
            border: 1px solid #CCC;
            padding: 10px;
            overflow: hidden;
        }
        #avatarfileselector {
            background: url(../../public/home/images/avatar_upload.gif) no-repeat;
            position: relative;
        }
        #dian{
            background: red;
        }
    </style>
</head>
<body>
<?php require './head.php';?>
<div id="uhd">
    <div class="h cl">
        <div class="icn avt"></div>
        <h2 class="mt">
           找回密码</h2>
    </div>

    <ul class="tb cl" style="padding-left: 75px;">
        <li class="a" id="zhao"><a>找回密码</a></li>

    </ul>
</div>
<div id="xxx">
<form action="mima.php?a=xiu" method="post">
<table summary="个人资料" class="tfm" cellspacing="0" cellpadding="0">
    <tbody><tr>
        <input type="hidden" name="name" value="aa">
        <th>用户名</th>
        <td><input type="text" name="uname" id="oldpassword" class="px"></td>
    </tr>
    <tr>
        <th>邮箱</th>
        <td>
            <input type="email" name="email" id="newpassword" class="px">
        </td>
    </tr>

    </tbody></table>
<input  id="gai" style="text-align: center;width: 100px;margin-left:200px" value="下一步" type="submit"  >
</form>
</div>
<div id="touxiang" style="display: none">
    <form action="mima.php?a=yan" method="post">
        <table summary="个人资料" class="tfm" cellspacing="0" cellpadding="0">
            <tbody><tr>
                <input type="hidden" name="name" value="aa">
                <th>验证码</th>
                <td><input type="text" name="uname" id="oldpassword" class="px"></td>
            </tr>

            </tbody></table>
        <input  id="gai" style="text-align: center;width: 100px;margin-left:200px" value="下一步" type="submit"  >
    </form>
</div>
<?php require './footer.php';?>
<?php
switch (@$_GET['a']){
    case 'xiu';
        $uname = $_POST['uname'];
        $email = $_POST['email'];
        if (!empty($uname) && !empty($email)){
            $sql = "select * from user where userName = '$uname'";
            $result = mysqli_query($link,$sql);
            $rows = mysqli_fetch_assoc($result);
            if ($rows){
                $sql2 = "select * from userdetail where email = '$email'";
                $result2 = mysqli_query($link,$sql2);
                $rows2 = mysqli_fetch_assoc($result2);
                if ($rows2){
                        echo "<script> 
                    alert('请查收邮件获取验证码');
                    window.location.href = 'yan.php?email=$email&name=$uname';
                     </script>";
                }else{
                    echo "<script> 
                    alert('输出有误');
                    window.location.href = 'mima.php?email=$email&name=$uname';
                     </script>";
                }
            }

        }else{
            echo "<script> 
                    alert('内容不能为空');
                    window.location.href = 'mima.php?email=$email&name=$uname';
                     </script>";
        }
        break;
    case 'yan':

        break;
}


?>

